<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<title>巡视记录列表页</title>
		<link href="../../css/mui.min.css" rel="stylesheet"/>
		<script src="../../script/mui.min.js"></script>
		<link rel="stylesheet" href="../../css/api.css">
		<link rel="stylesheet" href="../../css/CFNetPP_Base.css">
		<link rel="stylesheet" type="text/css" href="../../css/iconfont.css"/>
		<link rel="stylesheet" type="text/css" href="../../css/base.css"/>
		<style>
			html, body {
				background-color: #f3f5f7;
			}
		</style>
	</head>
	<body>
		<div class="checkrecord ">
			<div class="bgwhite top_10">
				<p class="title titlepos">
					历史记录
				</p>
				<ul class="top_15 " id="record">
					<li class="recordlist "   >
					<p class="date base_dark_grey_shallow">
					<span class="redcircle mui-icon iconfont icon-circle acolor"></span><span class="mui-icon iconfont icon-shijian iconpos "></span>物理学家的门口
					</p>
					<p class="mui-ellipsis base_dark_grey_shallow">
					<span class="mui-icon iconfont font16 icon-dingwei base_light_gray iconpos"></span>北京接口
					</p>
					</li>
					<li class="recordlist "  >
					<p class="date base_light_gray">
					<span class="redcircle mui-icon iconfont icon-circle acolor"></span><span class="mui-icon iconfont icon-shijian iconpos "></span>物理学家的门口
					</p>
					<p class="mui-ellipsis base_dark_grey_shallow">
					<span class="mui-icon iconfont font16 icon-dingwei base_light_gray iconpos"></span>北京接口
					</p>
					</li>
				</ul>
			</div>
		</div>
	</body>
	<div class="noSign" hidden="hidden" id="noData">
		<img src="../../image/icon_img.png" width="60%">
		<p class="font16 top_15 base_dark_grey" >
			暂无数据
		</p>
	</div>
	<div class="loadFailure" hidden="hidden" id="noNet">
		<img src="../../image/icon_img01.png" width="60%">
		<p class="" >
			数据加载失败
		</p>
		<p>
			请检查您的网络
		</p>
		<button type="button"  onclick="RefreshData()"class="mui-btn mui-btn-outlined">
			重新加载
		</button>
	</div>
	<script src="../../script/common.js"></script>
	<script type="text/javascript" src="../../script/api.js"></script>
	<script src="../../script/jquery.min.js" type="text/javascript"></script>
	<script type="text/javascript" src="../../script/MD5.js"></script>
	<script type="text/javascript" src="../../script/requestTool.js"></script>
	<script type="text/javascript">
		var page = 1;
		apiready = function() {
			postprogress();
			setRefreshHeader();
			setPullUpRefresh();
			get_data();
			SendBehaviorTrajectoriesNotifi1('0', '巡视记录列表页', '115', api.pageParam.sourceurl, api.pageParam.sourcetitle, window.location.pathname, document.title);
			api.addEventListener({
				name : 'addpatroNotifi'
			}, function(ret, err) {
				//coding...
				page = 1;
				get_data();
			});
		}
		function CheckRecordInfoClick(id) {
			api.openWin({useWKWebView:true,
				name : 'teacherCheckRepotrInfo',
				url : 'teacherCheckRepotrInfo.html',
				pageParam : {
					id : id, //企业id
					sourceurl : window.location.pathname,
					sourcetitle : document.title
				},
				allowEdit : true
			});
		}

		function RefreshData() {
			$('#noNet').hide();
			postprogress();
			page = 1;
			get_data();
		}

		function get_data() {
			params = {
				uid : $api.getStorage('cfnetppuid'),
				school_id : $api.getStorage('cfnetppjid'),
				page : page,
				rows : "10",
			};
			cfnetppPOST(urlPatrolist, params, true, function(data, status) {
				api.hideProgress();
				api.refreshHeaderLoadDone();
				if (status == 'success') {
					if (data.status == 1) {
						list = data.json;
						if (list != null && list.constructor == Array && list.length > 0) {
							$('#noData').hide();
							adddata(list, list.length);
						} else {
							if (page == 1) {
								$('#noData').show();
								$('#record').html('');
							} else {
								api.toast({
									msg : '没有更多数据了',
									duration : 2000,
									location : 'bottom'
								});
							}
						}
					} else {
						if (page == 1) {
							$('#noData').show();
						}
					}
				} else {
					$('#noNet').show();
					api.toast({
						msg : '获取数据失败',
						duration : 2000,
						location : 'bottom'
					});
				}
			});
		};
		function adddata(list, len) {
			var list_html = '';
			for (var i = 0; i < len; i++) {
				var listdata = '<li class="recordlist " onclick="CheckRecordInfoClick(' + list[i].id + ')"><p class="date base_dark_grey_shallow"><span class="redcircle mui-icon iconfont icon-circle acolor"></span> <span class="mui-icon iconfont icon-shijian iconpos "></span>' + getCurrentDate(list[i].time) + '</p><p class="mui-ellipsis base_dark_grey_shallow"><span class="mui-icon iconfont font16 icon-dingwei base_light_gray iconpos"></span>' + list[i].report + '</p></li>';
				list_html = list_html + listdata;
			}
			if (page == 1) {
				$('#record').html(list_html);
			} else {
				$('#record').append(list_html);
			}
		}

		//下拉刷新
		function setRefreshHeader() {
			api.setRefreshHeaderInfo({
				visible : true,
				bgColor : '#ccc',
				textColor : '#fff',
				textDown : '下拉刷新...',
				textUp : '松开刷新...',
				showTime : true
			}, function(ret, err) {
				page = 1;
				get_data();
			});
		}

		// 上拉加载
		function setPullUpRefresh() {
			api.addEventListener({
				name : 'scrolltobottom'
			}, function(ret, err) {
				page = page + 1;
				get_data();
			});
		}

		function postprogress() {
			api.showProgress({
				style : 'default',
				animationType : 'fade',
				title : '正在请求数据...',
				text : '请稍等...',
				modal : true
			});
		}
	</script>
</html>